package com.tanhua.api.impl.db;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tanhua.api.db.UserInfoApi;
import com.tanhua.domain.db.UserInfo;
import com.tanhua.mapper.db.UserInfoMapper;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

@Service
public class UserInfoApiImpl implements UserInfoApi {

    @Autowired
    private UserInfoMapper userInfoMapper;



    @Override
    public void save(UserInfo userInfo) {
        userInfoMapper.insert(userInfo);

    }

    @Override
    public void update(UserInfo userInfo) {
        userInfoMapper.updateById(userInfo);
    }

    @Override
    public IPage findUsersByPage(Integer page, Integer pagesize) {

        Page pg=new Page(page,pagesize);
        IPage iPage = userInfoMapper.selectPage(pg, null);
        return iPage;
    }

    @Override
    public UserInfo findUserInfo(Long id) {
        return userInfoMapper.selectById(id);
    }
}
